import Vue from 'vue';
import Vuex from 'vuex';
import createLogger from 'vuex/dist/logger';

Vue.use(Vuex);//z注册插件

export default new Vuex.Store({
  plugins:[createLogger()],
  state:{//==data{}
    x:3,
    classList:[],
    userName:'登录',
    stateNumber:false,
    userId:'',
    MsgName:'',//事件名称
    MsgContent:'',//事件内容
    MsgDateTime:'',//事件提醒时间
  },
  mutations:{//==methods  state==this
    increatment(state, n){
      state.x =  state.x + n;
    },
    btnChangeName(state, name){
        state.userName = name;
    },
    btnChangestateNumber(state){
      state.stateNumber = true;
      console.log("状态由未登录状态转为登录状态");
    },
    btnChangeMsg(state, MsgName, MsgContent, MsgDateTime){
      state.MsgName = MsgName;
      state.MsgContent = MsgContent;
      state.MsgDateTime = MsgDateTime;
    }
  }
})
